package com.example.webflux;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.*;

@Configuration
public class WebFluxRouterDemo {
    public RouterFunction<ServerResponse> userGetRouterFunction(){

        return RouterFunctions.route(
                RequestPredicates.GET("/routerGetUser"),
                serverRequest -> {
                    System.out.println(serverRequest.path());
                    return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON).bodyValue(User.builder().age(13).name("evan").build());
                });
    }
}
